package cn.net.ecode.elec.api.web;

import cn.net.ecode.elec.ad.entity.ElecAd;
import cn.net.ecode.elec.ad.entity.ElecAdList;
import cn.net.ecode.elec.ad.service.ElecAdListService;
import cn.net.ecode.elec.ad.service.ElecAdService;
import cn.net.ecode.elec.template.entity.ElecTemplate;
import cn.net.ecode.elec.template.service.ElecTemplateService;
import cn.net.ecode.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName AppTemplateController
 * @Description 模版相关接口
 * @Author AlanShelby
 * @Date 2019/9/3 0003 21:19
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/template")
public class AppTemplateController {

    @Autowired
    private ElecTemplateService templateService;


    /**
     * @Method contractTemplate
     * @Description 获取线下签约合同地址接口
     * @Author AlanShelby
     * @Date 21:20 2019/9/3 0003
     * @Param [templateKey]
     * @Return cn.net.ecode.util.R
     */
    @RequestMapping("/contractTemplate")
    public R contractTemplate(@RequestParam String templateKey) {
        ElecTemplate contract = templateService.getByTemplateKey(templateKey);
        if (contract == null) {
            R.error("模版数据异常，请联系管理员");
        }

        return R.ok().put("contract", contract);
    }
}
